package cn.yunyichina.scheduler.jobs.job.refund;

import java.util.concurrent.atomic.AtomicInteger;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.type.simple.api.SimpleJob;

import cn.yunyichina.scheduler.jobs.service.refund.RefundHandlerService;

@Component
public class RefundHandlerJob implements SimpleJob {

    private static final Logger logger = LoggerFactory.getLogger(RefundHandlerJob.class);

    private static final AtomicInteger count = new AtomicInteger(0);

    @Resource
    private RefundHandlerService refundHandlerService;

    public void execute(ShardingContext shardingContext) {
        int current = count.addAndGet(1);
        logger.info("第[{}]次退费处理任务开始执行", current);
        refundHandlerService.doExecute();
        logger.info("第[{}]次退费处理任务执行结束", current);
    }

}